# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=perdition
pkgver=2.2
pkgrel=6
pkgdesc="A Mail retrieval proxy"
url="http://horms.net/projects/perdition/"
arch="all"
license="GPL-2.0-or-later"
makedepends="gdbm-dev openssl-dev>3 popt-dev vanessa_adt-dev vanessa_logger-dev
	vanessa_socket-dev"
install=$pkgname.pre-install
subpackages="$pkgname-doc $pkgname-openrc"
source="http://horms.net/projects/perdition/download/$pkgver/perdition-$pkgver.tar.xz
	perdition.initd
	perdition.confd
	"

prepare() {
 	default_prepare
	update_config_sub
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-gdbm \
		--disable-static \
		--disable-libtool-lock \
		--disable-mysql \
		--disable-odbc \
		--disable-pg \
		--disable-cdb \
		--disable-nis \
		--disable-posix-regex \
		--disable-ldap \
		--disable-daemon-map
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="1ee64505ffe5ad11893fe61a37343fd004d5c15ea88b3dd18e790482248d4b68adc57f2b9c4a1fc12b06087fa7fa01f913db6d1e44bd7e82fd549fd85937a866  perdition-2.2.tar.xz
02edb024edf1684efc3be1d9019b654e14f23d81f3746336f4a9699559fdac5e4874d775997454b87e8ddeec3cd7bcc954cb8ee61d358c85fd7e7ce75a944633  perdition.initd
49c765a24d828be9a0e8032778a5430028e41de18fa83bbe10806f454283e91fdda7f7cb62cfab4778501582597228806d3a86984cb9f2cb3254cf2d989a08ea  perdition.confd"
